package com.chixing.day04.JiCheng;

public class AccountInheritTest {
    public static void main(String[] args) {
        SavingAccountInherit sa = new SavingAccountInherit();
        //存款
        sa.depoist(1000);
        //取款
        sa.withdraw(500);
        sa.setAccNo(115);
        sa.setAccName("Smith");

        CreditAccountInherit cr = new CreditAccountInherit();
        //存款
        cr.depoist(1000);
        //取款
        cr.withdraw(500);


        System.out.println(sa);
        //等同于
        System.out.println(sa.toString());

        //父类 类型 = new 子类对象()
        //父类引用子类
        AccountInherit ACC = new SavingAccountInherit();
        System.out.println(ACC instanceof SavingAccountInherit); //true   //看堆中对象 的类型
        // SavingAccountInherit sa2 = new SavingAccountInherit(100,"fweq","98484",18550385036L,800f,0);
    }

}
